home *** CD-ROM | disk | FTP | other *** search
/ The X-Philes (2nd Revision) / The X-Philes Number 1 (1995).iso / xphiles / hp48hor2 / tune.doc < prev    next >
Text File  |  1995-03-31  |  7KB  |  233 lines

  1. TUNE -  Directory 
  2. Compressed music player 
  3. Copyright 1992 
  4. Brian Maguire 
  5. All Rights Reserved 
  6.  
  7. DISCLAIMERS 
  8.  
  9. TUNE and this manual are presented without warranties, expressed 
  10. or implied.  The author makes no guarantee as to the fitness of 
  11. this software. 
  12.  
  13. TUNE can be copied freely provided the software, including this 
  14. manual, is copied in its entirety.  The user cannot be charged, 
  15. in whole or in part, except for the cost of reproduction.  No 
  16. part of this package may be used for commercial purposes without 
  17. written permission from the author. 
  18.  
  19.  
  20. SUMMARY 
  21.  
  22. When I looked at the multitude of games available for the 48 I 
  23. noticed that many used very little sound.  The programs that 
  24. did use sound used a large amount of memory as well.  Since I 
  25. couldn't find anything on the boards that addressed this problem 
  26. I wrote a few simple programs in hopes that they might stir up 
  27. interest. 
  28.  
  29. These programs are by no means the most efficient way to play a 
  30. musical tune.  The main concept was to condense a series or real 
  31. numbers normally used by the BEEP command or system binaries used 
  32. by the setbeep command into a long hex string.  Each note is 
  33. represented by 10 nibbles in the string (5 for the frequency and 
  34. 5 for the duration).  Since musical notes are limited to a small 
  35. range of frequencies and durations, I could have used a look up 
  36. table or conversion function and represented each note with 4 
  37. nibbles (two for the freq. and two for the duration).  If I ever 
  38. find time (not likely) I might rewrite the programs and include 
  39. variables to allow the user to change the tempo and key.  A 
  40. graphical user interface for writing the tunes in musical 
  41. notation might also be nice (kind of like the equation writer). 
  42.  
  43.  
  44. The directory TUNE contains three programs and an example 
  45. tune list.  This list is the music that is played during the 
  46. opening screen in ANT.  I can be converted into a tune string 
  47. using the program L->H and played with either the TUNE or TUN1. 
  48. It also contains a sub-directory with examples.  These examples 
  49. were adapted from earlier music programs on the 48. 
  50.  
  51.  
  52. COMMANDS 
  53.  
  54. L->H 
  55.  
  56. Converts a list of frequencies and durations into a compacted hex 
  57. string which can be played with TUNE or TUN1.  The input list must 
  58. have matching freq/duration pairs.  To create a rest, a frequency of 0 
  59. will cause TUNE and TUN1 to remain silent for the specified frequency. 
  60. For example { 0 1 } is equivalent to 1 WAIT. 
  61.  
  62.  
  63. INPUT         OUTPUT 
  64. -----         ------ 
  65. List    ->    Hex string 
  66.  
  67.  
  68.  
  69. TUNE 
  70.  
  71. Plays a tune string created by L->H and displays the message 
  72. "PRESS ANY KEY..." in the menu area.  The tune is repeated 
  73. until a key is pressed.  There is also a loop that checks the 
  74. time and turns the 48 off after about 5 minutes. 
  75.  
  76. If you want the menu area restored or turned off after exiting 
  77. TUNE use the system RPL command DispMenu.1 or TURNMENUOFF. 
  78.  
  79. INPUT             OUTPUT 
  80. -----             ------ 
  81. Hex string   -> 
  82.  
  83.  
  84. TUN1 
  85. This program works almost like TUNE with one exception.  When 
  86. the 48 beeps the keyboard input (with the exception of the 
  87. [ON] key) is disabled.  Because of this, pressing a key while 
  88. in TUNE may not always exit the program.  TUN1 prompts the user 
  89. to press [ON] instead of "any key". 
  90.  
  91.  
  92. INPUT             OUTPUT 
  93. -----             ------ 
  94. Hex string   -> 
  95.  
  96.  
  97. ANT 
  98.  
  99. This list is the music played during the opening screen of 
  100. ANT.  To hear it first convert it into a tune string using 
  101. L->H and then run TUNE or TUN1. 
  102.  
  103.  
  104. Below is a system RPL listing of the directory MUSIC.  It was 
  105. created using the system RPL development library that will be 
  106. commercially available soon (cheap plug).  Although this 
  107. directory was created using the development library, the listing 
  108. can be compiled by any of the other system RPL assemblers by 
  109. modifying it slightly. 
  110.  
  111.  
  112. %%HP: T(2)A(D)F(.); 
  113.  
  114. DIR 
  115.  
  116. 'L\->H' 
  117.  
  118.   :: 
  119.      CK1NoBlame DUPTYPELIST? NcaseSIZEERR 
  120.      DUPNULL{}? caseSIZEERR INNERCOMP 
  121.      # 2h #/ SWAP #1= caseSIZEERR HXS 0 
  122.      SWAP #1+_ONE_DO ROT COERCE #>HXS SWAP 
  123.      !append$ SWAP (1415F) COERCE #>HXS 
  124.      SWAP !append$ LOOP 
  125.   ; 
  126.  
  127. 'TUNE' 
  128.  
  129.   :: 
  130.      CK1NoBlame DUPTYPEHSTR? NcaseSIZEERR DUP 
  131.      LENHXS DUP#0= caseSIZEERR # Ah #/ DROP 
  132.      #0<> caseSIZEERR "PRESS ANY KEY..." 
  133.      DispCoord1 CLKTICKS SWAP # 1h BEGIN 2DUP 
  134.      2DUP DUP #4+ SUBHXS HXS># UNROT # 5h 
  135.      #+DUP #4+ SUBHXS HXS># DUP#0=ITE 
  136.       :: 
  137.         DROP UNCOERCE % 8.192 %* %># (1A7ED) 
  138.       ; 
  139.     setbeep #10+ 2DUPSWAP LENHXS #> IT DROPONE 
  140.     CLKTICKS 4PICK bit- HXS 6 DEE752 HXS>HXS 
  141.     %0<> IT 
  142.       :: 
  143.         ROTDROP CLKTICKS UNROT TurnOff 
  144.       ; 
  145.     ATTN? GETTOUCH OR UNTIL 3DROP CLEARMENU 
  146.     FLUSHKEYS ATTN? ?SEMI DROP ATTNFLGCLR 
  147.   ; 
  148.  
  149. 'TUN1' 
  150.  
  151.   :: CK1NoBlame DUPTYPEHSTR? NcaseSIZEERR 
  152.      DUP LENHXS DUP#0= caseSIZEERR # Ah #/ 
  153.      DROP #0<> caseSIZEERR "PRESS ON TO CONTINUE" 
  154.      DispCoord1 CLKTICKS SWAP # 1h BEGIN 2DUP 
  155.      2DUP DUP #4+ SUBHXS HXS># UNROT # 5h 
  156.      #+DUP #4+ SUBHXS HXS># DUP#0=ITE 
  157.        :: 
  158.          DROP UNCOERCE % 8.192 %* %># (1A7ED) 
  159.        ; 
  160.      setbeep #10+ 2DUPSWAP LENHXS #> IT 
  161.      DROPONE CLKTICKS 4PICK bit- HXS 6 DEE752 
  162.      HXS>HXS %0<> IT 
  163.        :: 
  164.          ROTDROP CLKTICKS UNROT TurnOff 
  165.        ; 
  166.      ATTN? UNTIL 3DROP FLUSHKEYS ATTNFLGCLR 
  167.      CLEARMENU 
  168.   ; 
  169.  
  170. 'ANT' 
  171.  
  172. { % 220 % .375 % 329 % .1875 % 0 % .375 % 220 % .1875 % 329 % 
  173. .1875 % 220 % .1875 % 247 % .375 % 294 % .1875 % 0 % .1875 % 247 
  174. % .375 % 294 % .1875 % 0 % .1875 } 
  175.  
  176. END 
  177.  
  178. [Note: Detlef M ller emailed the following: 
  179.  
  180.     I really enjoyed 'William Tell and friends'; but I have a little 
  181.     suggestion for TUN1: 
  182.  
  183.     Change 
  184.         :: ROTDROP CLKTICKS UNROT TurnOff ; 
  185.     into 
  186.         :: TurnOff ROTDROP CLKTICKS UNROT ; 
  187.  
  188. This change allows the HP 48 to be turned back on (after the 5-minute 
  189. timeout) with a fresh 5-minute countdown for the timeout.  So I made 
  190. that change to TUNE and TUN1 on the disk, in both the TUNE directory 
  191. and the TOONS directory. -jkh-] 
  192.  
  193. The sub-directory DEMO contains 15 examples that were adapted 
  194. from earlier music programs on the 48. 
  195.  
  196.  
  197. Tunes adapted from Leland B. Lightfoot's MUSIK directory. 
  198.  
  199. 'BACHMAJ'   (1st movement of Bach violin concerto in E major) 
  200.  
  201.  
  202.  
  203. Tunes adapted from Jeffrey Broido's "MUSIC" directory. 
  204.  
  205. 'S1.4thM'   (Sym 1, C mi, 4th mvt. By J. Brahms d. 1897) 
  206. 'TLYOU'     ("Till There Was You" by Meridith Wilson) 
  207. 'JPRDY'     (Jeopardy! theme) 
  208. 'OLDHOUSE'  (This Old House) 
  209. 'INDIAN'    ("I'm an Indian, too" By Irving Berlin) 
  210. 'HLiLo'     ("Hi Lili, Hi Lo" By Bronuslaw Kaper) 
  211. 'YSTDAY'    ("Yesterday" By Lennon/McCartney) 
  212. 'JUDE'      ("Hey, Jude" By Lennon/McCartney) 
  213. 'BDAY'      (Happy Birthday) 
  214. 'MTL6'      ("Motel Six" By Tom Bodette) 
  215.  
  216.  
  217.  
  218. Tunes adapted from Greg Beck's MUSIC directory. 
  219.  
  220. 'DISNEY'    (The Main Street Electric Parade i.e. Disney song) 
  221. 'INDY'      (The Theme from Indiana Jones) 
  222. 'OLIMPIC'   (The Olympic Theme) 
  223. 'MLDY'      (The Theme from the Tom & Jerry Show?) 
  224.  
  225.  
  226.  
  227.  
  228. Enjoy, 
  229.  
  230. Brian Maguire 
  231. 139 Kingsbury 
  232. Dearborn, MI 48128 
  233.